const mock = require('mockjs')
const Random = mock.Random
const getQuestionList = require('../AnalogData/QuestionListData')
const getComponentList = require('./getComponentList')
module.exports = [
  {
    url: '/api/question/:id',
    method: 'get',
    response() {
      return {
        error: 0,
        data: {
          id: Random.id(),
          title: Random.ctitle(),
          desc: '页面的描述',
          css: '',
          js: '',
          isPublish: true,
          isDeleted: false,
          componentList: getComponentList()
        },
        msg: 'success'
      }
    }
  },
  {
    url: '/api/questionpost',
    method: 'post',
    response() {
      return {
        error: 0,
        data: {
          id: Random.id()
        },
        msg: 'success'
      }
    }
  },
  {
    url: '/api/questionpost/list',
    method: 'get',
    response(ctx) {
      return {
        error: 0,
        data: {
          list: getQuestionList(ctx),
          total: 100
        },
        msg: 'success'
      }
    }
  },
  {
    url: '/api/question/:id',
    method: 'patch',
    response(ctx) {
      return {
        error: 0,
        data: {
          msg: 'success'
        },
        msg: 'success'
      }
    }
  },
  {
    url: '/api/question/copy/:id',
    method: 'post',
    response() {
      return {
        error: 0,
        data: {
          id: Random.id()
        },
        msg: 'success'
      }
    }
  },
  {
    url: '/api/question',
    method: 'delete',
    response() {
      return {
        error: 0,
        msg: 'success'
      }
    }
  }
]
